/**
 * 养护模块接口列表
 */
import axios from "../../http/axios"; // 导入接口域名列表
import base from "../base";

const curing = {
  //养护记录列表
  queryRecordsPage(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/feedback/query`,
      params
    );
  },
  //养护任务列表
  queryTasksPage(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/task/query`,
      params
    );
  },

  //删除养护任务
  deleteTask(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/task/deleteByIds`,
      params
    );
  },
  //养护验收
  accpetTask(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/task/acceptance`,
      params
    );
  },
  //分发人员 分页查询
  queryPersonPage(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/person/query`,
      params
    );
  },
  //部门列表
  queryCompanyList(params) {
    // return https.get(`${base.curingUrl}/maintenance/bridge/person/queryDepartments`, {
    //   params: params
    // }, null, {
    //   'app-key': '5ab089ca77014874868482ebb85b424b'
    // });
    return axios.get(`${base.cloudUrl}/permission/dept/tree/app-key/all`, {
      params,
    });
  },
  //部门的人员列表
  queryCompanyPersonsList(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/person/queryPersons`,
      params
    );
  },
  //养护任务新增
  addCuringTask(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/task/create`,
      params
    );
  },

  //按桥梁病害类型统计
  queryDiseaseBridgeAll(params) {
    return axios.get(
      `${base.curingUrl}/statistics/queryInspTypeCountByBridgeAll`,
      {
        params: params,
      }
    );
  },

  //养护记录报表导出
  downLoadCuringRecord(params) {
    return axios.get(`${base.curingUrl}/maintenance/bridge/download`, {
      params: params,
    });
  },
  //根据任务ID查询任务详情
  queryTaskById(params) {
    return axios.get(
      `${base.curingUrl}/maintenance/bridge/task/queryTaskById`,
      {
        params: params,
      }
    );
  },

  //小修保养
  //添加
  addMaintenance(params) {
    return axios.post(`${base.curingUrl}/maintenance_routine/add`, params);
  },
  //查询列表   //后端是body传参 页面
  queryMaintenance(params) {
    return axios.post(`${base.curingUrl}/maintenance_routine/findAll`, params);
  },
  //详情
  queryMaintenanceDetail(params) {
    return axios.get(`${base.curingUrl}/maintenance_routine/${params}`);
  },
  //删除
  delMaintenance(params) {
    return axios.post(`${base.curingUrl}/maintenance_routine/${params}`);
  },
  //编辑
  updateMaintenance(params) {
    return axios.post(`${base.curingUrl}/maintenance_routine/update`, params);
  },

  //养护统计
  //日历接口
  queryCalendar(params) {
    return axios.get(`${base.curingUrl}/maintenance/bridge/queryCalendar`, {
      params: params,
    });
  },
  //病害占比
  queryDiseaseCount(params) {
    return axios.get(`${base.curingUrl}/maintenance/bridge/queryDiseaseCount`, {
      params: params,
    });
  },

  //巡检统计病害百分比
  queryDisease(params) {
    return axios.get(
      `${base.curingUrl}/maintenance/bridge/queryDiseaseDegree`,
      {
        params: params,
      }
    );
  },

  // 养护病态bar图表

  queryDiseaseBar(params) {
    return axios.get(
      `${base.curingUrl}/maintenance/bridge/queryCountByBridgeAll`,
      {
        params: params,
      }
    );
  },

  //类型统计
  queryMaintenanceCount(params) {
    return axios.get(
      `${base.curingUrl}/maintenance/bridge/queryMaintenanceCount`,
      {
        params: params,
      }
    );
  },

  //巡检统计
  //日历接口
  queryTaskByDate(params) {
    return axios.get(`${base.inspUrl}/insp/statistics/queryInspCalendar`, {
      params,
    });
  },
  //巡检类型统计
  queryTaskTotal(params) {
    return axios.get(`${base.inspUrl}/insp/statistics/queryInspTypeCount`, {
      params,
    });
  },

  queryDiseaseListById(params) {
    return axios.get(
      `${base.inspUrl}/insp/task/query/queryDiseaseListByTaskId?id=${params}`
    );
  },
  queryBridgeAll(params) {
    return axios.get(
      `${base.inspUrl}/insp/statistics/queryInspTypeCountByBridgeAll`,
      {
        params,
      }
    );
  },

  queryTypeTotal(params) {
    return axios.get(`${base.inspUrl}/insp/statistics/queryHistoryTypeCount`, {
      params,
    });
  },

  //养护计划
  //查询
  queryPlansPage(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/plan/query`,
      params
    );
  },
  //新增
  addPlan(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/plan/create`,
      params
    );
  },
  //删除
  deletePlan(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/plan/deleteByIds`,
      params
    );
  },
  //编辑
  updatePlan(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/plan/updateById`,
      params
    );
  },
  //详情
  queryPlanById(params) {
    return axios.get(`${base.curingUrl}/maintenance/bridge/plan/queryById`, {
      params: params,
    });
  },
  //启用、关闭
  setPlanStatus(params) {
    return axios.post(
      `${base.curingUrl}/maintenance/bridge/plan/openOrClose`,
      params
    );
  },
  //查询养护记录详情
  queryRecordById(params) {
    return axios.get(
      `${base.curingUrl}/maintenance/bridge/feedback/queryById`,
      {
        params: params,
      }
    );
  },
};

export default curing;
